# subprocess模块

import subprocess
#
# res1 = subprocess.Popen('dir', shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
# print(res1.stderr.read())  # b'' 无错误信息结果 打印结果为bytes类型的空字符串
# print(res1.stdout.read())  # 有标准输入信息 打印bytes类型的字符串

res2 = subprocess.Popen('dir', shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
print(res2.stdout.read().decode('gbk'))
stdout.read()
stderr.read()